package com.java.thread;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;

public class ReentrantLockTests {

    static int count;
    static ReentrantLock lock=new ReentrantLock();
    static int count() throws InterruptedException {

        lock.tryLock(2, TimeUnit.SECONDS);
        try{
            return count++;
        }finally {
            lock.unlock();
        }
    }
    public static void main(String[] args) {

    }
}
